package demo.chain.inter.impl.entry;

import demo.chain.inter.impl.AbstractLinkedProcessorSlot;

public class DefaultImplProcessorSlot {
  private AbstractLinkedProcessorSlot first = null;
  private AbstractLinkedProcessorSlot last = null;
  
  public AbstractLinkedProcessorSlot getInstance() {
    return this.first;
  }
  
  /**
   * 添加到最后的节点
   *
   * @param currentAddNode 当前添加的节点
   * @author lihh
   */
  public DefaultImplProcessorSlot addLast(AbstractLinkedProcessorSlot currentAddNode) {
    if (this.first == null) {
      this.first = this.last = currentAddNode;
    } else {
      this.last.setNext(currentAddNode);
      this.last = currentAddNode;
    }
    
    return this;
  }
}
